﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SMSSnew.DATA;
using SMSSnew.CLASSES;


namespace SMSSnew.UI
{
    public partial class StudentEditAcc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            //if (IsPostBack)
            //{
          
            //}

        }

        protected void ButEdit_Click(object sender, EventArgs e)
        {
            userAccountDA myuserAccountDA = new userAccountDA();
            myuserAccountDA.updateUser(txtUname.Text, txtPword.Text, txtSecQ.Text, txtSecA.Text,txtFullName.Text, txtmail.Text, txtPhoneNum.Text);
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('User account edit successfully. !');", true);
            Response.Redirect("userAccountHome.aspx");
        
        }

        protected void txtUname_TextChanged(object sender, EventArgs e)
        {
           
        }

        protected void txtPword_TextChanged(object sender, EventArgs e)
        {
           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            userAccountDA myuserAccountDA = new userAccountDA();
            DataTable dataUser;

            dataUser = myuserAccountDA.loadUser(txtUname.Text);

            if (dataUser.Rows.Count != 0)
            {
                txtPword.Text = dataUser.Rows[0][0].ToString();
                txtSecQ.Text = dataUser.Rows[0][1].ToString();
                txtSecA.Text = dataUser.Rows[0][2].ToString();
                txtFullName.Text = dataUser.Rows[0][3].ToString();
                txtmail.Text = dataUser.Rows[0][4].ToString();
                txtPhoneNum.Text = dataUser.Rows[0][5].ToString();
            }
        }

        protected void txtSecA_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
